def isprime(n):
    if n<=1:
        return 0
    for i in range(2,n):
        if n%i==0:
            return 0
    return 1

n=0
while 1:
    P=n**2+n+41
    if isprime(P)==1:
        n=n+1
    else:
        print n
        break
